var resMe = {
    WangEditor: null,
    data: null,
    init: function () {
        resMe.creatEditor();
    },
    creatEditor: function () {
        var E = window.wangEditor
        addBlog.WangEditor = new E('#editor');
        addBlog.WangEditor.customConfig.uploadImgServer = '/article/upload';
        addBlog.WangEditor.uploadFileName = 'file';

        var text = document.getElementById("text");
        addBlog.WangEditor.customConfig.onchange = function (html) {
            text.value = html;

        }
        addBlog.WangEditor.create();
        var content = document.getElementById('mId');
        if (content == null) {
            resMe.WangEditor.txt.html("<p>请输入内容...</p>")
        } else {
            resMe.WangEditor.txt.html(content.innerText)
        }
        text.value =resMe.WangEditor.txt.html();
    },
    save:function (url) {
        var mId = document.getElementById('mId').value;
        var content = document.getElementById("text").value;
        var title = document.getElementById("title").value;
        $.ajax({
            type:"post",
            url:url,
            dataType:'json',
            data:{id:mId,title:title,content:content},
            async:false,
            success:function (data) {
                if (data.code == 200){
                    layer.msg(data.msg,{time:2000,icon:1});
                } else{
                    layer.msg(data.msg,{time:500,icon:2})
                }
            }
        })
    }
}